<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.PreparedStatement" %><%--
  Created by IntelliJ IDEA.
  User: 32104
  Date: 2024/6/9
  Time: 下午4:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新增</title>
    <link href="../../CSS/Four.css" type="text/css" rel="stylesheet">
    <script type="text/javascript">
        window.onload = function () {
            var btnSubEle = document.getElementById("submit");
            btnSubEle.onclick = function () {
                var userId = document.getElementById("ID").value;
                if (userId === "" || userId === null) {
                    alert("学生编号不能为空,请重新输入!")
                }

                var userName = document.getElementById("name").value;
                if (userName === "" || userName === null) {
                    alert("学生姓名不能为空,请重新输入!");
                    return false;
                }

                var userAge = document.getElementById("age").value;
                if (userAge === "" || userAge === null) {
                    alert("学生年龄不能为空,请重新输入!");
                    return false;
                }

                var userAddress = document.getElementById("address").value;
                if (userAddress === "" || userAddress === null) {
                    alert("学生地址不能为空,请重新输入!");
                    return false;
                }

                var userPhone = document.getElementById("phone").value;
                if (userPhonee === "" || userPhone === null) {
                    alert("学生姓名不能为空,请重新输入!");
                    return false;
                }

            }
        }
    </script>
</head>
<style>
    table button{
        border-color: chartreuse;
        background-color: aquamarine;
        font-family: cursive;
        border-radius: 10px;
    }

    button a{
        text-decoration: none;
        color: black;
    }
</style>
<body>
<div id="d4" style="    background-color: mistyrose;
    height: 500px;
    width: 300px;
    display: flex;
    margin: auto;
    justify-content: center;
    align-items: center;
    vertical-align: middle;">
    <form action="../add/addSecond.jsp" method="post" id="add_form">
        <table>
            <caption style="font-size: 25px;font-family: monospace;">新增学生信息</caption>
            <tr>
                <td class="t1" style="
    color: lightskyblue;
    font-style: oblique;
    font-family: cursive;
    font-size: 15px;">编号:
                </td>
                <td>
                    <input type="text" maxlength="12" style="outline: none" name="id" class="put" id="ID"/>
                </td>
            </tr>
            <tr>
                <td class="t1" style="    color: lightskyblue;
    font-style: oblique;
    font-family: cursive;
    font-size: 15px;">姓名:
                </td>
                <td>
                    <input name="studentName" maxlength="12" style="outline: none" type="text" class="put" id="name"/>
                </td>
            </tr>
            <tr>
                <td class="t1" style="    color: lightskyblue;
    font-style: oblique;
    font-family: cursive;
    font-size: 15px;">年龄:
                </td>
                <td>
                    <input name="studentAge" maxlength="12" style="outline: none" type="text" class="put" id="age"/>
                </td>
            </tr>
            <tr>
                <td class="t1" style="    color: lightskyblue;
    font-style: oblique;
    font-family: cursive;
    font-size: 15px;">地址:
                </td>
                <td>
                    <input name="studentAddress" type="text" maxlength="12" class="put" id="address"/>
                </td>
            </tr>
            <tr>
                <td class="t1" style="    color: lightskyblue;
    font-style: oblique;
    font-family: cursive;
    font-size: 15px;">电话:
                </td>
                <td>
                    <input type="tel" maxlength="11" name="studentPhone" class="put" id="phone"/>
                </td>
            </tr>
            <tr>
                <td>
                    <input type="radio" name="studentSex" value="1" class="put" id="sex" required/>
                    男
                </td>
                <td>
                    <input type="radio" name="studentSex" value="0" class="put" id="sex1" required/>
                    女
                </td>
            </tr>
            <tr>
                <td>
                    <button type="submit">新增</button>
                </td>
                <td>
                    <button type="reset">取消</button>
                    <button type="button"><a href="../select/select01.jsp">返回</a></button>
                </td>
            </tr>
        </table>
    </form>
</div>
</body>
</html>